#version 460
#extension GL_GOOGLE_include_directive : enable
#extension GL_EXT_shader_explicit_arithmetic_types_int64 : require

//#include "../../../../core/shader_std.h" 

layout(location = 0) in vec4 vColor;
layout(location = 1) in vec4 vEye;
layout(location = 2) in vec4 vPoint;
layout(location = 3) in float vDis;

layout(location=0) out vec4 outColor;
//layout(early_fragment_tests) in;

void main(void){
	float L = min(length((vEye.xyz) - vPoint.xyz), vDis);
	//(gl_FragCoord.xy / screenSize) * 2.0 - 1.0,
	//L = clamp(abs(L * gl_FragCoord.w * 0.5), 0, 1);
	//L *= 0.01;
	//L += 1;
	L /= vDis;
	//L = clamp(abs(L * 0.1), 0, 1);

	outColor = vColor;
	outColor.a *= smoothstep(0, 1, (1 - L));
	//outColor = vec4(vec3(L)* gl_FragCoord.w * 0.01, 1);
	//outColor.rgb = vec3(gl_FragCoord.z);

	//gl_FragDepth = (1 - gl_FragCoord.z);
}



